<template>
	<el-card shadow="never">
		<el-form ref="form" :model="form" label-width="120px" style="margin-top:20px;" label-position="top">
			<el-form-item label="基础设置">
				<sc-form-table ref="table" v-model="form.detail" :addTemplate="addTemplate" placeholder="暂无数据" height="600" hideAdd hideDelete showIndex>
					<el-table-column label="参数名称" align="center" prop="switch_name" width="150"></el-table-column>
					<el-table-column label="参数值" align="center" prop="number">
						<template #default="scope">
							<span style="margin-right: 10px;color: #666;">{{ scope.row.remark }}</span>
							<el-input-number v-model="scope.row.number" :min="0" :placeholder="scope.row.remark" style="width: 50%;"></el-input-number>
						</template>
					</el-table-column>
					<el-table-column label="是否启用" align="center" prop="technology">
						<template #default="scope">
							<el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1"></el-switch>
						</template>
					</el-table-column>
				</sc-form-table>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="submit">保存</el-button>
			</el-form-item>
		</el-form>
	</el-card>
</template>

<script>
export default {
	props: {
		info: Object
	},
	data() {
		return {
			form: {
				detail: [],
			}
		}
	},
	mounted() {
		this.getParams();
	},
	methods: {
		async getParams() {
			var res = await this.$API.setting.setparams.get({ type: 6 });
			this.form.detail = res.data
		},
		async submit() {
			var res = await this.$API.setting.editparams.post(this.form);
			if (res.code == 1) {
				this.getParams();
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", { type: 'error' })
			}
		},
	},
}
</script>

<style></style>
